﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SAM.Framework.Configuration;
using SAM.Configuration.Service;
using SAM.Configuration.Domain;

namespace SAM.Configuration.Test
{
    public class Config
    {
        public string Name { get; set; }

        public string Value { get; set; }
    }

    class Program
    {
        static void Main(string[] args)
        {
            SAM.Framework.Configuration.IRead readHandler = new SAM.Configuration.Service.DefaultReadConfigurationService();
            var ls = readHandler.Read<IList<Config>>("Test.js", FileType.JSON);
            ls.ToList().ForEach((config) =>
            {
                Console.WriteLine(config.Name + " " + config.Value);
            });
            IWriter writer = new SAM.Configuration.Service.DefaultReadConfigurationService();

            Config aconfig = new Config();
            aconfig.Name = "TestName";
            aconfig.Value = "TestValue";
            writer.Writer<Config>(FileType.JSON, aconfig);
            writer.Writer(FileType.XML, aconfig);

            Console.ReadKey();
        }
    }
}
